package com.uwlaser.service.impl;

import com.uwlaser.base.impl.CommonServiceImpl;
import com.uwlaser.domain.ProductParams;
import com.uwlaser.service.ProductParamsService;
import com.uwlaser.service.mapper.ProductParamsMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.stream.Collectors;

@AllArgsConstructor
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ProductParamsServiceImpl extends CommonServiceImpl<ProductParamsMapper,ProductParams> implements ProductParamsService {
    @Override
    public List<Integer> queryProductIdByParamId(Integer id) {
        return lambdaQuery().eq(ProductParams::getProductModelId, id).list().stream().map(ProductParams::getParamDetailId)
                .collect(Collectors.toList());
    }
}
